<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TaskView
 *
 * @author markus
 */
class TaskView {
    
    public static function display(Task $task){
        echo '<div class="task_item';
        if($task->getImportant() == 1){ echo ' task_important'; }
        echo '">';
        echo '<div class="task_remaining ';
            $remaining = $task->getRemainingDays();
            if($task->getArchived() == 1){
                echo 'task_upcoming';
            } else if ($remaining <= 0){
                echo 'task_overdue';
            } else if ($remaining <= 3){
                echo 'task_current';
            } else {
                echo 'task_upcoming';
            }
        echo '">';
        echo $task->getArchived() == 1 ? "OK" : $remaining;
        echo '</div>';
        echo '<div class="notification_title" title="'.$task->getId().'">'.$task->getTitle().'</div>';
        echo '<div class="notification_content">'.$task->getContent().'</div>';
        echo '<div class="notification_info">Von '.$task->getCreator().' am '.date("d.m.Y", strtotime($task->getAdded())).' um '.date("H:i", strtotime($task->getAdded())).' Uhr. ';
        echo 'Zu erledigen bis '.date("d.m.Y", strtotime($task->getDeadline())).'. ';
        echo $task->getArchived() == 0 ? '<a class="link_markdone" href="?action=markdone&id='.$task->getId().'">Erledigen.</a>&nbsp;' : 'Erledigt am '.date("d.m.Y", strtotime($task->getModified())).'.';
        echo '</div>';
        echo '</div>';
    }
    
}

?>
